# -*- coding: utf-8 -*-

import unittest, datetime
import hurryoff.services.googleAPIService as gApi

class GoogleApiServiceTests(unittest.TestCase):

    def test_getCountryCode(self):
        self.assertEquals(gApi.getCountryCodeByLocation(u"російська федерація"), "RU")
        self.assertEquals(gApi.getCountryCodeByLocation(u"україна"), "UA")
        self.assertEquals(gApi.getCountryCodeByLocation(u"болгарія"), "BG")
        self.assertEquals(gApi.getCountryCodeByLocation(u"украина", lang="ru"), "UA")
        self.assertEquals(gApi.getCountryCodeByLocation(u"польша", lang="ru"), "PL")

    def test_getCoordinates(self):
        self.assertFalse(gApi.getGeoCoordinates(u"конотоп-пас.", "UA") is None)
        self.assertFalse(gApi.getGeoCoordinates(u"сучава норд", "RO") is None)
        self.assertFalse(gApi.getGeoCoordinates(u"джурджу норд", "RO") is None)
        self.assertFalse(gApi.getGeoCoordinates(u"мездра", "BG") is None)
        self.assertTrue(gApi.getGeoCoordinates(u"русє", "BG") is None)
        self.assertTrue(gApi.getGeoCoordinates(u"вікшани", "RO") is None)
